home *** CD-ROM | disk | FTP | other *** search
- /* Copy stdin to stdout, substituting any %s for the current timestamp
- * (hacked out of makeDNS.c). The idea is that the HS-class header should
- * just $INCLUDE anything it needs, which will have been generated separately.
- */
-
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/time.h>
- #include <time.h>
-
- #define LINEBUFFER 120
- #define LOG "/dev/tty"
-
- int main()
- { time_t tt;
- struct tm *ttm;
- char *t;
- char stamp[20];
- char buffer[LINEBUFFER];
-
- tt = time(NULL);
- ttm = localtime(&tt);
- (void) sprintf(stamp, "%d%3.3d%3.3d",
- ttm->tm_year, ttm->tm_yday,
- ((60 * ttm->tm_hour) + ttm->tm_min) >> 1);
- t = asctime(ttm);
-
- (void) printf(";; Generated on %s\n", t);
-
- for (;;) {
- if (fgets(buffer, LINEBUFFER, stdin) == NULL) break;
- (void) printf(buffer, stamp);
- }
- return 0;
- }
-